<template>
  <view class="canvas-test-page">
    <!--手写签名-->
		<sign-box  v-if="!signVisible" identity="投保人" :realName="userInfo.realName" :fileId="signId" @toResign="toResign" :signImgPath="signImgPath"></sign-box>
		<sign-canvas v-if="signVisible" :realName="userInfo.realName" :userInfo="userInfo" @signCancel="signCancel" @signConfirm="signConfirm" :signImgPath="signImgPath"></sign-canvas>
  </view>
</template>

<script>
import SignBox from "@/components/sign-box/sign-box.vue";
import SignCanvas from "@/components/sign-canvas/sign-canvas.vue";
import "./index.scss";
export default {
  components: {
    SignBox,
    SignCanvas
  },
  data() {
    return {
      userInfo: {
				realName: '黄女士'
			},
			signVisible: false,
			signId: '', // 图片fileId
      signImgPath: ''
    };
  },
  methods: {
		toResign() {
			this.signVisible = true
		},
		signCancel(){
      this.signVisible = false
    },
    signConfirm({signId, signImgPath}){
      this.signId = signId
      this.signImgPath = signImgPath
      this.signVisible = false
    },
  }
};
</script>
